local bailang = fk.CreateSkill{
    name = "lingling__bailang"
}
Fk:loadTranslationTable{
    ["lingling__bailang"] = "白浪",
    [":lingling__bailang"] = "出牌阶段限一次，若你本回合未使用【杀】，你可以摸两张牌并视为使用【杀】，本回合你的手牌上限-2。当你受到伤害后，伤害来源本回合视为拥有此技能。",
    ["#lingling__bailang"] = "白浪：摸两张牌并视为使用【杀】，本回合你的手牌上限-2",
}

bailang:addEffect("viewas", {
    prompt = "#lingling__bailang",
    anim_type = "offensive",
    card_num = 0,
    card_filter = Util.FalseFunc,
    max_phase_use_time = 1,
    view_as = function (self, player, cards)
        local card = Fk:cloneCard("slash")
        card.skillName = bailang.name
        return card
    end,
    before_use = function (self, player, use)
        player:drawCards(2, bailang.name)
        player.room:addPlayerMark(player, MarkEnum.MinusMaxCardsInTurn, 2)
    end,
    enabled_at_play = function (self, player)
        return #player:getViewAsCardNames(bailang.name, {"slash"}) > 0 and self:withinTimesLimit(player, Player.HistoryPhase) and player.phase == Player.Play and player:usedCardTimes("slash") == 0
    end,
})

bailang:addEffect(fk.Damaged, {
    anim_type = "negative",
    priority = 2,
    can_trigger = function (self, event, target, player, data)
        return target == player and player:hasSkill(bailang.name) and data.from and data.from ~= player
    end,
    on_cost = Util.TrueFunc,
    on_use = function (self, event, target, player, data)
        if not data.from:hasSkill(bailang.name) then
            local room = player.room
            room:setPlayerMark(data.from, bailang.name.."-turn", 1)
            room:handleAddLoseSkills(data.from, bailang.name, nil, false, true)
        end
    end,
})

bailang:addEffect(fk.TurnEnd, {
    can_refresh = function (self, event, target, player, data)
        return player:hasSkill(bailang.name) and player:getMark(bailang.name.."-turn") ~= 0
    end,
    on_refresh = function (self, event, target, player, data)
        local room = player.room
        room:handleAddLoseSkills(player, "-"..bailang.name, nil, false, true)
    end,
})

return bailang